package com.oa.organization.service.impl;

import com.oa.oaspccommon.po.Dept;
import com.oa.organization.mapper.DeptMapper;
import com.oa.organization.service.DeptService;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zd
 * @date 2021年04月16日 9:02
 */
@Service
public class DeptServiceImpl implements DeptService {

    @Autowired
    private DeptMapper deptMapper;


    @Override
    public List<Dept> findDeptByCompany() {
        return deptMapper.findDeptByCompany();
    }

    @Override
    public List<Dept> findDepts(Integer deptno) {
        return deptMapper.findDepts(deptno);
    }

    @Override
    public Dept findByDeptid(Integer deptid) {
        return deptMapper.findByDeptid(deptid);
    }

    @Override
    public int addDept(Dept dept) {
        try {
            int i = deptMapper.addDept(dept);
            return i;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public int updateDept(Dept dept) {
        try {
            int i = deptMapper.updateDept(dept);
            return i;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public int delDept(Integer deptid) {
        try {
            int i = deptMapper.delDept(deptid);
            return i;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }
}
